<%@ page session="false"%>
<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>演示界面</title>
</head>
<body>
	<ul>
		<li>
			<h4>1、API网关测试</h4> 
			<input type="button" id="butApi" value="测试" />
			<div>
				<textarea id="uriVal"
					style="width: 500px; height: 34px;"></textarea>
				<br>返回结果：<div id="apiJson" style="font-size: 10px"></div>
			</div>
		</li>
	</ul>
</body>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	//初始化数据 
	$("#uriVal").text('http://localhost:8080/janus/api?method=user.getUser&params={"userId":1}');
	 $("#butApi").click(function(){
		var url=$("#uriVal").val();
	 	$.ajax({
			 url:url,
			 type:"post",
			 dataType:"json",
			 success:function(result){
		        $("#apiJson").text(JSON.stringify(result));
		     },
		     error:function(e){
		    	 $("#apiJson").text(JSON.stringify(e));
		     }
	 	});
	 });
});
</script>
</html>
